package com.rd.student.jiaji.class4.suyan.zrrd.day13;

import java.io.IOException;

public class RuntimeTest {
    public static void main(String[] args) throws IOException {
      /*  Process process=null;
        //是一种饿汉式的单例
        Runtime runtime=Runtime.getRuntime();
        process=runtime.exec("notepad");

       */
        Runtime runtime=Runtime.getRuntime();
        //处理器个数

        System.out.println(runtime.availableProcessors());
        //最大内存，以字节为单位
        System.out.println(runtime.maxMemory());
        //总内存
        System.out.println(runtime.totalMemory());
        //剩余内存
        System.out.println(runtime.freeMemory());
        for (int i=0;i<1000;i++){
            new Object();
        }
        System.out.println(runtime.freeMemory());
        runtime.gc();
        System.out.println(runtime.freeMemory());
    }
}
